package com.corecloud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corecloud.entity.SysRoleEntity;
import com.corecloud.mapper.mysql.SysRoleMapper;
import com.corecloud.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("sysRoleService")
public class SysRoleServiceImpl implements SysRoleService {

    @Autowired
    private SysRoleMapper sysRoleMapper;


    @Override
    public SysRoleEntity getByParas(QueryWrapper<SysRoleEntity> paras) {
        return sysRoleMapper.selectOne(paras);
    }

    @Override
    public List<SysRoleEntity> getListByParas(QueryWrapper<SysRoleEntity> qw) {
        return sysRoleMapper.selectList(qw);
    }

    @Override
    public Page<SysRoleEntity> getInfoByPage(Page page, QueryWrapper<SysRoleEntity> qw) {
        return sysRoleMapper.selectMapsPage(page,qw);
    }

    @Override
    public Integer insertInfo(SysRoleEntity info) {
        return sysRoleMapper.insert(info);
    }

    @Override
    public void deleteInfo(Integer id) {
        sysRoleMapper.deleteById(id);
    }

    @Override
    public Integer updateInfo(SysRoleEntity info) {
        return sysRoleMapper.updateById(info);
    }

    @Override
    public List<Map<String, Object>> getMapByParas(QueryWrapper<SysRoleEntity> qw) {
        return sysRoleMapper.selectMaps(qw);
    }

}